<template>
	<view class="page-box">
		<uni-cusTitle title=' ' :isIcon='true' img='/static/index/jiantou1.png'></uni-cusTitle>
		<view class="time-box">领券时间：2024.01.12-01.2</view>
		
		<view class="lunbo-box">
			<view class="wh100 swiper-tem">
				<swiper class="wh100" @change="change" :current="swiperDotIndex" autoplay circular :interval='2000'>
					<swiper-item v-for="(item, index) in swiperList" :key="index" @click="itemTap(item,index)">
						<view class="wh100">
							<image class="wh100" :src="item.cover_imgurl"></image>
						</view>
					</swiper-item>
				</swiper>
			</view>
		</view>

		<view class="detail-box">
			<view class="youhui-box">
				<view class="item-box" :class="{lose:item.lose}" v-for="(item,index) in youList" :key="index" @click="showMask(item,index)">
					<!-- 过期，或者使用完 -->
					<image class="wh100" src="/static/index/you2.png" v-if="item.lose"></image>
					<!-- 正常 -->
					<image class="wh100" src="/static/index/you1.png" v-else></image>
					
					<view class="left">
						<view>
							{{item.price}}
							<text>元</text>
						</view>
					</view>
					<view class="right">
						<view class="s-left">
							<text>{{item.title}}</text>
							<view>{{item.time}}</view>
						</view>
					</view>
				</view>
			</view>
			
			<view class="youhui-list">
				<view class="item-box" :class="{lose:item.lose}" v-for="(item,index) in youList" :key="index" @click="showMask(item,index)">
					<!-- 过期，或者使用完 -->
					<image class="wh100" src="/static/quans2.png" mode="widthFix" v-if="item.lose"></image>
					<!-- 正常 -->
					<image class="wh100" src="/static/quans.png" mode="widthFix" v-else></image>
					<view class="left">
						<view>
							{{item.price}}
							<text>元</text>
						</view>
					</view>
					<view class="right">
						<view class="s-left">
							<text>{{item.title}}</text>
							<view>{{item.time}}</view>
						</view>
					</view>
				</view>
			</view>
			
			<view class="s-title">活动说明</view>
			<view class="detail" v-html="detail.text"></view>
		</view>
		
		<!-- 弹框 -->
		<uni-popup ref="popup" background-color="transparent" mask-background-color='rgba(0,0,0,.7)'>
			<view class="popup-content">
				<image src="http://www.qidoer.com/xcx/static/index/bg01.png"></image>
				
				<view class="title">
					<view>天生桥景区优惠券</view>
					<text>（有效期至2024.12.12）</text>
				</view>
				<view class="price">
					<view class="num">
						90
						<text>元</text>
					</view>
					<text class="tip">满100元可用</text>
				</view>
				<view class="bottom">
					<view class="daka-btn" @click="hideMaska">
						<text>立即使用</text>
					</view>
					<text class="ok"  @click="hideMask">好的，知道了</text>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				staticUrl:this.$base.staticUrl,
				swiperList: [{
						cover_imgurl: 'http://www.qidoer.com/xcx/static/quanbg.png'
					}
				],

				youList: [{
					id:1,
					price: 90,
					text1: '满100减30元',
					title: '无门槛消费券',
					time: '全商户可用',
					type: 0,
					lose:false
				},
				{
					id:1,
					price: 90,
					text1: '满100减30元',
					title: '无门槛消费券',
					time: '全商户可用',
					type: 0,
					lose:false
				},
				{
					id:1,
					price: 90,
					text1: '满100减30元',
					title: '无门槛消费券',
					time: '全商户可用',
					type: 0,
					lose:true
				}],
				
				detail: {
					text: '规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明规则说明'
				}
			}
		},

		onLoad() {

		},
		methods: {
			showMask(item,index) {
				this.$refs.popup.open('center')
			},
			hideMask(){
				this.$refs.popup.close()
			},
			hideMaska(){
				uni.navigateTo({
					url:'../my/huiDetail'
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	page{
		background: #A7DA7C;
	}
	.lunbo-box {
		width: 100%;
		height: 912rpx;
		position: relative;
	}
	
	.page-box{
		padding-bottom: 100rpx;
		background: #A7DA7C;
	}
	
	.time-box{
		position: absolute;
		top:300rpx;
		left:50%;
		z-index: 10;
		transform: translateX(-50%);
		width: 384rpx;
		height: 56rpx;
		background: #884FFF;
		border-radius: 31rpx;
		border: 4rpx solid #FFE695;
		
		font-size: 26rpx;
		font-weight: bold;
		color: #FFDD57;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.detail-box {
		width: 100%;
		padding: 0rpx 30rpx;
		box-sizing: border-box;
		background: #A8D97C;
		margin-top:-146rpx;
		padding-top:60rpx;
		
		// 优惠券
		.youhui-box {
			width: 100%;
		
			.item-box {
				width: 100%;
				height: 184rpx;
				position: relative;
				display: flex;
				margin-bottom: 30rpx;
		
				image {
					position: absolute;
					left: 0;
					top: 0
				}
		
				.left {
					width: 182rpx;
					height: 100%;
					display: flex;
					align-items: center;
					justify-content: center;
					position: relative;
					font-weight: bold;
					font-size: 80rpx;
					font-family: AaHouDiHei;
					color: #FD4A5C;
					text-shadow: 0px 0px 0px #FFDD57;
		
					view {
						position: relative;
		
						text {
							display: inline-block;
							width: 40rpx;
							height: 40rpx;
							background: #FFFAE8;
							text-align: center;
							line-height: 40rpx;
							position: absolute;
							right: -6rpx;
							bottom: 20%;
							
							font-size: 26rpx;
							color: #FD4A5C;
							text-shadow: 0px 0px 0px #FFDD57;
							border-radius: 50%;
						}
					}
				}
		
				.right {
					flex: 1;
					height: 100%;
					position: relative;
					padding: 20rpx 30rpx 20rpx 46rpx;
					box-sizing: border-box;
					display: flex;
					align-items: center;
					justify-content: space-between;
		
					.s-left {
						width: 300rpx;
						height: 100%;
						display: flex;
						flex-direction: column;
						justify-content: center;
		
						text {
							font-size: 35rpx;
							font-weight: bold;
							color: #002A3A;
							line-height: 56rpx;
						}
		
						view {
							font-size: 28rpx;
							font-weight: bold;
							color: #3A525E
						}
					}
				}
			}
			.item-box.lose{
				.left{
					color: #84929A;
					text-shadow: 0px 0px 0px #FFDD57;
					view{
						text {
							
							background: #FFFAE8;
						
							color: #84929A;
							text-shadow: 0px 0px 0px #FFDD57;
							
						}
					}
				}
				
			}
		}
		
		.youhui-list{
			width: 100%;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			.item-box {
				width: 332rpx;
				height: 120rpx;
				position: relative;
				display: flex;
				margin-bottom: 30rpx;
				
				image {
					position: absolute;
					left: 0;
					top: 0
				}
					
				.left {
					width: 90rpx;
					height: 100%;
					display: flex;
					align-items: center;
					justify-content: center;
					position: relative;
					font-weight: bold;
					font-size: 40rpx;
					font-family: AaHouDiHei;
					color: #FD4A5C;
					text-shadow: 0px 0px 0px #FFDD57;
					
					view {
						position: relative;
					
						text {
							display: inline-block;
							width: 24rpx;
							height: 24rpx;
							background: #FFFAE8;
							text-align: center;
							line-height: 24rpx;
							position: absolute;
							right: -6rpx;
							bottom: 10%;
							
							font-size: 14rpx;
							color: #FD4A5C;
							text-shadow: 0px 0px 0px #FFDD57;
							border-radius: 50%;
						}
					}
				}
					
				.right {
					height: 100%;
					position: relative;
					padding: 20rpx 6rpx 20rpx 10rpx;
					box-sizing: border-box;
					display: flex;
					align-items: center;
					justify-content: space-between;
					
					.s-left {
						height: 100%;
						display: flex;
						flex-direction: column;
						justify-content: center;
					
						text {
							font-size: 24rpx;
							font-weight: bold;
							color: #002A3A;
							line-height: 56rpx;
						}
					
						view {
							font-size: 22rpx;
							font-weight: bold;
							color: #3A525E
						}
					}
				}
			}
			.item-box.lose{
				.left{
					color: #84929A;
					text-shadow: 0px 0px 0px #FFDD57;
					view{
						text {
							
							background: #FFFAE8;
						
							color: #84929A;
							text-shadow: 0px 0px 0px #FFDD57;
							
						}
					}
				}
				
			}
			
		}
	}
	
	// 活动说明
	.s-title {
		width: 100%;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		height: 52rpx;
		font-size: 36rpx;
		font-weight: bold;
		color: #002A3A;
		margin-bottom: 10rpx;
	
		&::before {
			content: '';
			display: block;
			width: 6rpx;
			height: 32rpx;
			background: #884FFF;
			border-radius: 4rpx;
			margin-right: 16rpx;
		}
	}
	
	.detail {
		font-size: 28rpx;
		color: #3A525E;
		line-height: 23px;
		font-weight: bold;
	}
	
	.popup-content {
		width: 558rpx;
		height: 802rpx;
		position: relative;
	
		image {
			width: 100%;
			height:100%;
		}
		
		.title {
			width: 100%;
			height:130rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			position: absolute;
			bottom: 550rpx;
			left: 0;
			font-size: 26rpx;
			color: #3A525E;
			view{
				font-size: 36rpx;
				font-weight: bold;
				color: #002A3A;
				line-height: 60rpx;
			}
		}
		.price {
			width: 100%;
			height:250rpx;
			position: absolute;
			bottom: 290rpx;
			left: 0;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			.num {
				width: 154rpx;
				font-weight: bold;
				font-size: 128rpx;
				font-family: AaHouDiHei;
				position: relative;
				color: #FD4A5C;
				text {
					display: inline-block;
					width: 64rpx;
					height: 64rpx;
					background: #FFF5CE;
					text-align: center;
					line-height: 64rpx;
					position: absolute;
					right: -20rpx;
					bottom: 20rpx;
					
					font-size: 30rpx;
					color: #FD4A5C;
					text-shadow: 0px 0px 0px #FFDD57;
					border-radius: 50%;
				}
			}
			.tip{
				font-size: 30rpx;
				font-weight: bold;
				color: #3A525E;
			}
		}
		.bottom {
			width: 100%;
			height:250rpx;
			position: absolute;
			bottom: 0;
			left: 0;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			.daka-btn {
				width: 494rpx;
				height: 96rpx;
				background: #FFDD57;
				border-radius: 48rpx;
				display: flex;
				justify-content: center;
				align-items: center;
			
				font-size: 36rpx;
				font-weight: bold;
				color: #884FFF;
			
				image {
					width: 48rpx;
					height: 48rpx;
					margin-right: 16rpx;
				}
			}
			.ok{
				font-size: 30rpx;
				font-weight: bold;
				color: #FFFFFF;
				margin-top:36rpx
			}
		}
	}
</style>